﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ModelLibrary;

namespace WebC
{
    public partial class PwdEdit : clsBaseForm
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnSure_Click(object sender, EventArgs e)
        {
            string code, pwd, newpwd;
            bool result = false;
            clsSys clss = null;
            code = txtcode.Text.ToString();
            pwd = txtpwd.Text.ToString();
            newpwd = txtnewpwd.Text.ToString();
            pwd = this.MD5Encrypt(txtpwd.Text.ToString());
            newpwd = this.MD5Encrypt(newpwd);            
            clss = new clsSys();
            result = clss.changePwd(code, pwd, newpwd);
            if (result == true)
            {
                Response.Write("<script>alert('保存成功');window.location='Default.aspx';</script>");
              
                if (clss != null)
                {
                    clss.Dispose();
                }

            }
            else
            {
                Response.Write("<script>alert('输入不对');</script>");

            }
        }
        protected void btnChangePwd_Click(object sender, EventArgs e)
        {
            Response.Redirect("default.aspx");
        }
    }
}